<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->increments('id');
            $table->integer("goods_category_id")->default(0)->comment("商品分类");
            $table->string("goods_sn",50)->default('')->comment("商品唯一货号");
            $table->string("goods_name",120)->default('')->comment("商品名称");
            $table->string("desc",255)->default('')->comment("描述");
            $table->string("thumb",150)->default('')->comment("商品缩略图");
            $table->integer("sell_price")->default(0)->comment("售价（分）");
            $table->integer("market_price")->default(0)->comment("市场价（分）");
            $table->integer("cost_price")->default(0)->comment("进货价（分）");
            $table->mediumInteger("stock",8)->default(0)->comment("库存");
            $table->mediumInteger("sales",8)->default(0)->comment("实际销量");
            $table->mediumInteger("virtual_sales",8)->default("虚拟销量");
            $table->smallInteger("click_num",5)->default(0)->comment("浏览量");
            $table->text("detail")->default('')->comment("商品详情");
            $table->smallInteger("sort")->default(50)->comment("排序 从小到大");
            $table->tinyInteger("is_onsale",1)->default(0)->comment("是否上架 0否 1是");
            $table->tinyInteger("is_hot",1)->default(0)->comment("是否热门 0否 1是");
            $table->tinyInteger("is_best",1)->default(0)->comment("是否是精品；0，否；1，是 ");
            $table->tinyInteger("is_new",1)->default(0)->comment("是否是新品 0，否；1，是");
            $table->tinyInteger("is_deleted",1)->default(0)->comment("是否删除 0否 1是");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods');
    }
}
